<?php
	/*
	 *digg顶踩插件
	 *BY QiuJun
	 */
	 
	switch($ts){
		case "digg_add":
			$topicid = $_POST['topicid'];
			$userid = $_POST['userid'];
			$digg = $_POST['digg'];
			
			$diggNum = $DB->once_num_rows("select * from ".dbprefix."app_group_topics_plugin_digg where topicid='$topicid' and userid='$userid'");
			
			if($diggNum>'0'){
				echo '0';
			}else{
				$DB->query("insert into ".dbprefix."app_group_topics_plugin_digg (`topicid`,`userid`,`digg`) values ('$topicid','$userid','$digg')");
				echo '1';
			}
			
			break;
	}